package com.jtny.nytb.equipment.vo.dataparam;

import cn.hutool.core.util.ObjectUtil;
import com.jtny.component.entity.BaseDTO;
import com.jtny.component.util.BeanUtils;
import com.jtny.nytb.config.datafactor.dto.ConfigParamDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 智慧能源中心 - 伍天宇
 * @package com.jtny.nytb.energymonitor.equipment.vo.dataparam
 * @fileName ConfigParamVO.java
 * @createTime 2023年09月20日 09:36
 * @Copyright© 2023 jtny
 * 江投能源技术研究院 版权所有
 */
@Data
@ApiModel("标签参数映射")
@AllArgsConstructor
@NoArgsConstructor
public class ParamTempVO extends BaseDTO {

    @ApiModelProperty("id")
    private Long paramId;
    @ApiModelProperty("参数标识")
    private String paramSign;
    @ApiModelProperty("参数描述")
    private String paramDesc;
    @ApiModelProperty("映射类型")
    private String paramType;
    @ApiModelProperty("变量id")
    private Long variableId;
    @ApiModelProperty("变量值")
    private String variableValue;
    @ApiModelProperty("变量说明")
    private String variableDeclaration;

    public ConfigParamDTO buildDTO() {
        ConfigParamDTO configParamDTO = BeanUtils.copyToObject(this, ConfigParamDTO.class);
        configParamDTO.setParamdesc(paramDesc);
        return configParamDTO;
    }

    public ParamTempVO(ConfigParamDTO dto) {
        if (ObjectUtil.isNull(dto)) {
            return;
        }
        this.paramId = dto.getParamId();
        this.paramSign = dto.getParamSign();
        this.paramDesc = dto.getParamdesc();
        this.paramType = dto.getParamType();
        this.variableId = dto.getVariableId();
        this.variableValue = dto.getVariableValue();
        this.variableDeclaration = dto.getVariableDeclaration();
    }

}
